# -*- coding:utf-8 -*-
import os

"""
输入路径，获取此路径下的文件路径

"""

a = '<a href="${0}">${1}</a>'

def readFolder(path, deep):
    filelist=os.listdir(path)
    #该文件夹下所有的文件（包括文件夹）
    
    for files in filelist:      #遍历所有文件
        olddir = os.path.join(path, files)
        if os.path.isdir(olddir):
            for i in range(deep - 1):
                print(end="    ")
            print("-", end=" ")
            print(files)
            readFolder(olddir, deep + 1)
        if not os.path.isdir(olddir):
            for i in range(deep - 1):
                print(end="    ")
            print("-", end=" ")
            b = a.replace("${1}", os.path.splitext(files)[0])
            b = b.replace("${0}", os.path.join(path, files)[36:].replace("\\", "/"))
            print(b)


if __name__ == '__main__':
    path = input('please input path:')  
    readFolder(path, 1)
